package com.example.leetcode;

import lombok.Data;

import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;

public class Test {
    @Data
    private static class stu {
        private Integer id;
        private Integer h;
        private Integer w;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s=scanner.nextLine();
        String s1=scanner.nextLine();
        String s2=scanner.nextLine();
        scanner.close();
        String[] strings = s1.trim().split(" ");
        String[] strings1 =s2.trim().split(" ");
        List<stu> stus = new ArrayList<>();
        for (int i=0;i<Integer.valueOf(s);i++){
            stu stu = new stu();
            stu.setId(i+1);
            stu.setH(Integer.valueOf(strings[i]));
            stu.setW(Integer.valueOf(strings1[i]));
            stus.add(stu);
        }




        List<Integer> list =stus.stream().sorted(Comparator.comparingInt(stu::getH).thenComparing(stu::getW,Comparator.reverseOrder())).map(stu::getId).collect(Collectors.toList());

        //比较大小 Comparator.comparingInt(对象：：属性).thenComparing(Comparator.comparingInt(),Comparator.reverseOrder())
  /*  List<String> stus1 =stus.stream().sorted(Comparator.comparingInt(stu::getH).
            thenComparing(Comparator.comparingInt(stu::getW)
                    .thenComparing(stu::getId,Comparator.reverseOrder()))).map(stu::getId).collect(Collectors.toList()));
        StringBuffer stringBuffer = new StringBuffer();
*/
     /*   System.out.println(Arrays.asList(stus1).toArray());*/
    }
}
